//package com.mo.axion.handler.receiver.kafka;
//
//import cn.hutool.core.collection.CollUtil;
//import com.alibaba.fastjson.JSON;
//import com.mo.axion.common.domain.TaskInfo;
//import com.mo.axion.handler.utils.GroupIdMappingUtils;
//import com.mo.axion.support.mq.constants.MessageQueuePipeline;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.kafka.clients.consumer.ConsumerRecord;
//import org.springframework.beans.factory.config.ConfigurableBeanFactory;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.context.annotation.Scope;
//import org.springframework.kafka.annotation.KafkaListener;
//import org.springframework.kafka.support.KafkaHeaders;
//import org.springframework.messaging.handler.annotation.Header;
//import org.springframework.stereotype.Component;
//
//import java.util.List;
//import java.util.Optional;
//
///**
// * @author Mo
// * @createTime 2024/4/14 20:56
// * @description
// */
//@Slf4j
//@Component
//@ConditionalOnProperty(name = "axion.mq.pipeline", havingValue = MessageQueuePipeline.KAFKA)
//public class TestReceiver {
//
//    @KafkaListener(topics = "#{'${axion.business.log.topic.name}'}", groupId = "test")
//    public void consumer(ConsumerRecord<?, String> consumerRecord, @Header(KafkaHeaders.GROUP_ID) String topicGroupId) {
//        Optional<String> kafkaMessage = Optional.ofNullable(consumerRecord.value());
//        System.out.println(kafkaMessage.get());
//        System.out.println("axionTraceLog Consumed!!!");
//        if (kafkaMessage.isPresent()) {
////            List<TaskInfo> taskInfoList = JSON.parseArray(kafkaMessage.get(), TaskInfo.class);
////            String messageGroupId = GroupIdMappingUtils.getGroupIdByTaskInfo(CollUtil.getFirst(taskInfoList));
////            if (topicGroupId.equals(messageGroupId)) {
////                log.info("kafkaListener接收到消息，groupId:{}, params:{}", messageGroupId, JSON.toJSONString(taskInfoList));
////                consumeService.consume2Send(taskInfoList);
////            }
//        }
//    }
//}
